package com.ruoyi.web.controller.manager.tool;
import java.time.DayOfWeek;  
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.temporal.TemporalAdjusters;  
  
public class CurrentWeekRange {  
    public static LocalDateTime[] weekStartAndEnd( LocalDateTime today) {  
//        LocalDateTime today = ;  
  
        // 获取本周的第一天（周一）  
        LocalDateTime startOfWeek = today.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));  
  
        // 获取本周的最后一天（周日）  
        LocalDateTime endOfWeek = today.with(TemporalAdjusters.nextOrSame(DayOfWeek.SUNDAY));  
  
        return new LocalDateTime[] { startOfWeek, endOfWeek };
    }  
}